package com.chessimo.config;

import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.swing.ImageIcon;

import com.chessimo.main.Chess;

public class Definitions {
	public static Font fontButtons = new Font("Arial", Font.BOLD, 12);
	public static Font fontButtonsMenu = new Font("Arial", Font.PLAIN, 20);
	public static Font fontInfo = new Font("Arial", Font.PLAIN, 14);
	public static Font fontInfoBold = new Font("Arial", Font.BOLD, 14);
	public static Font fontLabelTitle = new Font("Arial", Font.BOLD, 16);
	public static Font fontCombos = new Font("Arial", Font.PLAIN, 12);
	public static Font fontBoard = getFontChess(58);
	public static Font fontTitle = new Font("Arial", Font.BOLD, 20);

	public static Font fontClock = new Font("Arial", Font.BOLD, 18);
	public static Font fontMoves = new Font("Arial", Font.PLAIN, 12);
	public static Font fontComments = new Font("Arial", Font.PLAIN, 12);
	public static Font fontCaptured = getFontChess(28);
	public static Font fontHeader = new Font("Arial", Font.BOLD, 16);
	public static Font fontSmall = new Font("Arial", Font.PLAIN, 11);
	public static Font fontCoord = new Font("Arial", Font.BOLD, 12);
	public static Font fontCapturedCounter = new Font("Arial", Font.BOLD, 10);
	public static Font fontButtonHistory = new Font("Arial", Font.BOLD, 12);
	public static Font fontPB = new Font ("Arial", Font.PLAIN, 18);
	
	public static Font fontInfoDB = new Font("Arial", Font.PLAIN, 16);
	public static Font fontInfoDBTitle = new Font("Arial", Font.BOLD, 20);
	
	
	public static Color border = new Color(250, 250, 250);
	public static Color bg1 = new Color(245, 245, 245);
	public static Color cor1 = new Color(250, 250, 250);
	public static Color corBGBoard = new Color(114, 71, 33);
	public static Color corTitle = new Color(140, 140, 140);
	public static Color corBut = new Color(255, 255, 255);
	public static Color myBlack = new Color(95, 95, 95);
	public static Color myGray = new Color(224, 224, 224);
	
	public static ImageIcon BG_IMAGE = getBackGroundImage();
	public static ImageIcon BG_LINE = getBackGroundLine();

	
	public static Font getFontChess(int tam) {
		Font fontBase = null;
		Font fontReal = null;
		String fName = "fontes/DiagramTTFritz.TTF";
		try {
			InputStream myStream = new BufferedInputStream(new FileInputStream(
					fName));
			fontBase = Font.createFont(Font.TRUETYPE_FONT, myStream);
			fontReal = fontBase.deriveFont(Font.PLAIN, tam);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.err.println(fName + " not loaded.");
		}
		return fontReal;
	}
	
	
	public static ImageIcon getBackGroundImage() {
		String fileImg = "images/a.png";
		ImageIcon backgroundImage = new ImageIcon(fileImg);
		Image img = backgroundImage.getImage();
		Image newimg = img.getScaledInstance(Chess.frameWidth, Chess.frameHeight, Image.SCALE_SMOOTH);
		backgroundImage = new ImageIcon(newimg);
		return backgroundImage;
	}
	
	public static ImageIcon getBackGroundLine() {
		String fileImg = "images/fundo_linha.PNG";
		ImageIcon backgroundImage = new ImageIcon(fileImg);
		Image img = backgroundImage.getImage();
		Image newimg = img.getScaledInstance(img.getWidth(null), img.getHeight(null), Image.SCALE_SMOOTH);
		backgroundImage = new ImageIcon(newimg);
		return backgroundImage;
	}
		
}
